<!DOCTYPE HTML>
<html>
<HEAD>
<meta charset="utf-8">
<TITLE>积分项目一览表</TITLE>
</HEAD>
<body>
    
<?php
include_once("base-class.php");

//新建sae数据库类
$mysql = new SaeMysql();

//获取当前页码
$page=intval($_GET["page"]);

//获取操作标识传入
//$action=$_GET["action"];
//$action= string::un_script_code($action);
//$action= string::un_html($action);


//获取员工ID号传入
$roster_id=intval($_GET["id"]);
//列表数据获取、分页

//计算总数
$count=$mysql->getVar("select COUNT(*) from gift where gift_status = 1");
//如果数据表里有数据
if($count)
{
    //每页显示记录数
    $page_num = 300;
    //如果无页码参数则为第一页
    if ($page == 0) $page = 1;
    //计算开始的记录序号
    $from_record = ($page - 1) * $page_num;
    //获取符合条件的数据
    // $list_list=$mysql->getData("select *
    //          from list where $list_name =  $rostar_name
    //          limit $from_record,$page_num");
    
    

        $gift_list=$mysql->getData("select gift_code,gift_item,gift_score,gift_dynamic,gift_unit,gift_details
                from gift where gift_status = 1 ORDER BY gift_code limit $from_record,$page_num ");
    //分页函数
    $multi = multi($count, $page_num, $page, "gift_list.php");
}
?>
    <!--页面名称-->
	<h3>积分项目一览表</h3>
    <!--列表开始-->

    <table border=1>
        <tr>
            <td>积分代码</td><td>积分项目</td><td>分值</td><td>积分单位</td><td>确认标准</td>
        </tr>
        <?php
			if($gift_list)
            {
                
                foreach($gift_list as $value)
                {
                    if ($value[gift_dynamic]==0)
                    {    
                        echo "<tr>
                              <td>$value[gift_code]</td>
                              <td>$value[gift_item]</td>
                              <td>$value[gift_score]</td>
                              <td>$value[gift_unit]</td>
                              <td>$value[gift_details]</td>
                              <tr>";
                    }
                    else if ($value[gift_dynamic]==1)
                    {
                        echo "<tr>
                              <td>$value[gift_code]</td>
                              <td>$value[gift_item]</td>
                              <td>$value[gift_score]/汇率</td>
                              <td>$value[gift_unit]</td>
                              <td>$value[gift_details]</td>
                              <tr>";                        
                    }
                }
            }
			else
            {
                echo "<tr><td colspan=7>无记录</td></tr>";
            }
        ?>
    
    </table>
    <?php
	echo $multi;
    ?>
</body>
</html>
